package cate.game.role.pvp.pointrace.msg;

import cate.game.GameBody;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import lombok.NoArgsConstructor;

import static cate.game.client.msg.MsgSender.send;
import static cate.game.client.msg.id.MsgIdBPointRace.RANK_QUERY_REQ;

@NoArgsConstructor
@ClientMsg(title = "排行榜排名查询 请求")
public class PointRaceRankQueryReq implements MsgInput {

    @Override
    public MsgConfig conf() {
        return RANK_QUERY_REQ;
    }

    @Override
    public void execute(GameBody game, ClientContext cc) {
        int index = game.pvp.pointRace.getHandler().getIndex(cc.getRole().getUid());
        send(cc::sendNow, new PointRaceRankQueryResp(index));
    }
}
